/*
 * @Description:
 * @Date: 2022-01-07 09:55:27
 * @Autor: shenxin <3120200077@bit.edu.cn>
 */
/*
有一销售人员类Sales,其数据成员有姓名name,身份证号id,年龄age。
重载输入/输出运算符实现对Sales类数据成员的输入和输出。
*/
#include <iostream>
#include <string.h>
using namespace std;

class Sales{
private:
    char name[10];
    char id[18];
    int age;
public:
    Sales(const char *Name, const char *ID, int Age);
    friend ostream &operator<<(ostream &os, Sales &s);
    friend istream &operator>>(istream &is, Sales &s);
};

Sales::Sales(const char *Name, const char *ID, int Age){
    strcpy(name,Name);
    strcpy(id,ID);
    age = Age;
}
ostream &operator<<(ostream &os, Sales &s){
    os<<s.name<<"\t";
    os<<s.id<<"\t";
    os<<s.age<<endl;
    return os;
}
istream &operator>>(istream &is, Sales &s){
    cout <<"输入雇员的姓名，身份证号，年龄"<< endl;
    is >> s.name >> s.id >> s.age;
    return is;
}

int main(){
    system("chcp 65001");
    char name[] = "张三";
    char id[] = "15611";
    Sales s1(name, id, 26);
    // Sales s1("杜康","214198012111711",40);
    cout<<s1;
    cout<<endl;
    cin>>s1;
    cout<<s1;
    return 0;
}
